package catchData.startup;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;

import org.apache.log4j.Logger;

import util.Conts;

/**
 * @author suwy
 * @date 2014-2-8
 * @todo TODO 统计文件的行数
 */
public class ThreadCountRowMedIds extends Thread {
	
	private static Logger LOG = Logger.getLogger(ThreadCountRowMedIds.class);
	private String fileName = "";
	
	public void run() {
		FileReader fr = null;
		LineNumberReader lnr = null;
		try {
			fr = new FileReader(new File(Conts.HTM_ROOT_PATH + fileName + ".csv"));
			lnr = new LineNumberReader(fr);
			String strLine = lnr.readLine();
	        int totalLines = 0;
	        while (strLine != null) {
	            totalLines++;
	            strLine = lnr.readLine();
	        }
	        LOG.info(fileName + ".csv 行数：" + totalLines);
		} catch (Exception e) {
			LOG.info(e);
		} finally {
			try {
				lnr.close();
				fr.close();
			} catch (IOException e) {
				LOG.info(e);
			}
		}
	}
	
	public static void main(String[] args) {
		ThreadCountRowMedIds instance = new ThreadCountRowMedIds();
		instance.start();
	}

}
